//
//  LWSportTrackingLine.m
//  LWmyTracking
//
//  Created by mac on 17/1/16.
//  Copyright © 2017年 ITLIN. All rights reserved.
//

#import "LWSportTrackingLine.h"

@implementation LWSportTrackingLine

- (instancetype)initWithStartLocation:(CLLocation *)startLocation andEndLocation:(CLLocation *)endLocation
{
    if(self = [super init])
    {
        self.startLocation = startLocation; // 给自己的属性赋值
        self.endLocation = endLocation;
    }
    return self;
}


//写polyLine的get方法

- (LWSportPolyLine *)polyLine
{
    UIColor *color = [UIColor redColor];
    //CLLoacationCoordinate2D 是一个结构体  --> 参数里面加了CLLocationCoordinate2D * -->这个* 号--->指的是这里参数需要传入一个结构体数组
    CLLocationCoordinate2D coords[2];//参数需要一个数组-->所以创建一个数组
        coords[0] = self.startLocation.coordinate;//给一个起点
        coords[1] = self.endLocation.coordinate;//给一个终点
    
    return [LWSportPolyLine polyLineWithCoordinate:coords andCount:2 andColor:color];
}


#pragma mark - 一些属性的get方法
//- (double)time
//{
//    
//}


- (double)speed
{
    return (self.startLocation.speed + self.endLocation.speed) * 0.5;
}

@end
